package com.framework.yhbapi.controller;

import com.framework.exception.util.RespResult;
import com.framework.service.yhbservice.YhbCurrentCountService;
import com.framework.service.yhbservice.YhbIndexService;
import com.framework.service.yhbservice.YhbNoticeService;
import com.framework.yhbEntity.Index.YhbIndex;
import com.framework.yhbEntity.notice.YhbNotice;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 功能描述:h5统一接口 不需要参数加密校验和token
 *
 * @author ck
 * @date 2018/11/16 14:01
 */
@RestController
@Api(value="h5统一接口",tags={"h5统一接口"})
@RequestMapping(value = "yhbh5")
public class YhbApiController {


	@Autowired
	private YhbNoticeService yhbNoticeService;
	@Autowired
	private YhbIndexService yhbIndexService;
	@Autowired
	private YhbCurrentCountService yhbCurrentCountService;

	/**
	 * H5上注册
	 * @param phone
	 * @param password
	 * @param confPassword
	 * @param smsCode
	 * @param pid
	 * @param name
	 * @return
	@PostMapping("notValidate/register")
	@ApiOperation("H5上注册")
	@ApiImplicitParams({
			@ApiImplicitParam(name="phone",value="手机号码",dataType="string", paramType = "query" ,required = true),
			@ApiImplicitParam(name="password",value="密码",dataType="string", paramType = "query",required = true),
			@ApiImplicitParam(name="confPassword",value="确认密码",dataType="string", paramType = "query",required = true),
			@ApiImplicitParam(name="smsCode",value="验证码",dataType="string", paramType = "query",required = true),
			@ApiImplicitParam(name="pid",value="推荐码",dataType="Long", paramType = "query",required = true),
			@ApiImplicitParam(name="name",value="真实姓名",dataType="string", paramType = "query",required = true),
			@ApiImplicitParam(name="deptId",value="渠道id",dataType="Long", paramType = "query",required = true)})
	public RespResult register(String phone, String password, String confPassword, String smsCode, Long pid, String name,Long deptId) {
		agentService.register(phone,password,confPassword,smsCode,pid,name, deptId);
		return RespResult.ok();
	}*/

	/**
	 * 系统通知详情
	 * @param noticeNo
	 * @return
	 */
	@GetMapping("notValidate/querySysNoticeInfo")
	@ApiOperation("系统通知详情")
	@ApiImplicitParams({
			@ApiImplicitParam(name="noticeNo",value="唯一id",dataType="string", paramType = "query",required = true)
	})
	public RespResult querySysNoticeInfo(String token,String noticeNo) {
		YhbNotice info = yhbNoticeService.queryNoticeByNo(token,noticeNo);
		return RespResult.ok().put("info",info);
	}

	/**
	 * Banner图详情
	 * @param id
	 * @return
	 */
	@GetMapping("notValidate/geHomeBanner")
	@ApiOperation("首页轮播图")
	@ApiImplicitParams({
			@ApiImplicitParam(name="id",value="所属Banner图Id",dataType="long", paramType = "query",required = true)
	})
	public RespResult getHomeBanner(Long id) {
		YhbIndex info = yhbIndexService.queryBannerInfoById(id);
		return RespResult.ok().put("info",info);
	}

	/**
	 * 账单详情
	 * @param token
	 * @return
	 */
	@PostMapping("notValidate/getCurrentCountInfoList")
	@ApiOperation("获取账单详情")
	@ApiImplicitParam(name="token",value="登录产生的token",dataType="String", paramType = "query",required = true)
	public RespResult getCurrentCountInfoList(String token,Integer pageNo){
		List<Map<String,Object>> list=yhbCurrentCountService.getCurrentCountInfoList(token,pageNo);
		return  RespResult.ok().put("list",list);
	}


	/**
	 * 冻结详情
	 * @param token
	 * @return
	 */
	@GetMapping("notValidate/queryFreezenFlow")
	@ApiOperation("冻结详情")
	@ApiImplicitParam(name="token",value="登录产生的token",dataType="String", paramType = "query",required = true)
	public RespResult queryFreezenFlow(String token,Integer pageNo){
		List<Map<String,Object>> list=yhbCurrentCountService.queryFreezenFlow(token,pageNo);
		return RespResult.ok().put("list",list);
	}



}
